#define _CRT_SECURE_NO_WARNINGS 1


#include <stdio.h>

int main() {
    int n = 0;
    scanf("%d", &n);
    int i = 0;
    int count = 0;
    int A = 0;
    int a = 0;
    int sa = 0;
    for (i = 0; i < n; i++)
    {
        int j = 0;
        char arr[101] = { 0 };
        int def = 0;
        scanf("%s", arr);
        if (*arr >= '0' && *arr <= '9')
        {
            printf("NO\n");
            continue;
        }
        while (*(arr+j))
        {
            if (*(arr + j) >= 'a' && *(arr + j) <= 'z')
            {
                a += 1;
            }
            else if (*(arr + j) >= 'A' && *(arr + j) <= 'Z')
            {
                A += 1;
            }
            else if (*(arr + j) >= '0' && *(arr + j) <= '9')
            {
                sa += 1;
            }
            else
            {
                def++;
            }
            count++;
            j++;
        }
        if (def == 1)
        {
            printf("NO\n");
        }
        else if ((count >= 8 && A > 0 && a > 0) || (count >= 8 && A > 0 && sa > 0) || (count >= 8 && sa > 0 && a > 0))
        {
            printf("YES\n");
        }
        else
        {
            printf("NO\n");
        }
    }
    
    return 0;
}
